/**
   A class to process names.
*/
public class Names
{
   /**
      Turns a name "First Last" into a name "Last, First"
      @param firstLast a name such as "Harry Smith", with a space separating
      the first and last name.
      @return a name such as "Smith, Harry", with the last name followed by
      a comma, a space, and the first name.
   */
   public String getLastFirst(String firstLast)
   {
      
      String lastFirst="";
      int i,t,k=0;
      t=firstLast.length();
      for (i=0;i<=(t-1);i++)
      {
         if (firstLast.charAt(i)==' ')
            k=i;
      }
      for (i=k+1;i<=(t-1);i++)
      {
         lastFirst=lastFirst + firstLast.charAt(i);
      }
      lastFirst=lastFirst + "," + " ";
      for (i=0;i<=k;i++)
      {
         lastFirst=lastFirst + firstLast.charAt(i);
      }
      return lastFirst;
   }
}